<%@ page language = "java" contentType="text/html; charset=UTF-8" %>

<%@ page import="com.creawor.imei.base.*,com.creawor.imei.util.*,com.creawor.hz_market.t_balance_office.*,com.creawor.km.util.*" %>
<%@ page import="java.util.*" %>
<head>
    <meta http-equiv="content-type" content="text/html; charset=GBK"/>
    <title>Google</title>
    <script src="js/google_northamerica_offices.js"></script>
    <script src="js/markermanager.js"></script>
	<link rel="stylesheet" href="../css/style.css">
	<link href="../css/css.css" rel="stylesheet" type="text/css">
	<%@ include file="../googlemap_include.jsp"%>
	
    <script  type="text/javascript">
	

//地图控制按钮
function TextualZoomControl() {}
TextualZoomControl.prototype = new GControl();


TextualZoomControl.prototype.initialize = function(map) {
      	var container = document.createElement("div");
 		var fullScreenDiv = document.createElement("div");
	   	var resScreenDiv = document.createElement("div");
	  	var maxS=document.createTextNode("全屏");
			resScreenDiv.style.display="none";
	  //zoomInDiv.style.font="small Arial 1em";

      	this.setButtonStyle_(fullScreenDiv);
      	container.appendChild(fullScreenDiv);
     
      	fullScreenDiv.appendChild(maxS);

	  //mixS.style.display=none;
      	GEvent.addDomListener(fullScreenDiv, "click", function FullScreen(){
	 
			var top=parent.document.getElementById("topmain");
			var left=parent.document.getElementById("leftmain");
			var bottom=parent.document.getElementById("bottommain");

			top.border=0;
			top.rows='0,*';
			left.border=0
			left.cols='0,*';
			bottom.border=0;
			bottom.rows="*,0";

			fullScreenDiv.style.display="none";
			resScreenDiv.style.display="block";

		});



	  	var mixS=document.createTextNode("退出全屏");
	  	//zoomInDiv.style.font="small Arial 1em";

      	this.setButtonStyle_(resScreenDiv);
      	container.appendChild(resScreenDiv);
     

	  	resScreenDiv.appendChild(mixS);
	  	//mixS.style.display=none;
      	GEvent.addDomListener(resScreenDiv, "click", function FullScreen(){
	  	 

			var top=parent.document.getElementById("topmain");
			var left=parent.document.getElementById("leftmain");
			var bottom=parent.document.getElementById("bottommain");
	
			top.border=5;
			top.rows='80,*';
			left.border=5;
			left.cols='248,*';
			bottom.border=5;
			bottom.rows="*,137";
			//document.getElementById("screentitle").value="全屏"

			// fullScreenDiv.appendChild(document.createTextNode(document.getElementById("screentitle").value));
		 	fullScreenDiv.style.display="block";
		  	resScreenDiv.style.display="none";
	
		});
      	
      	var zoomInDiv = document.createElement("div");
	  //zoomInDiv.style.font="small Arial 1em";

      	this.setButtonStyle_(zoomInDiv);
      	container.appendChild(zoomInDiv);
      	zoomInDiv.appendChild(document.createTextNode("地图"));
      	GEvent.addDomListener(zoomInDiv, "click", function() {
	 		map.setMapType(G_NORMAL_MAP);
      	});

      	var zoomOutDiv = document.createElement("div");

      	this.setButtonStyle_(zoomOutDiv);
      	container.appendChild(zoomOutDiv);
      	zoomOutDiv.appendChild(document.createTextNode("地形地图"));
      	GEvent.addDomListener(zoomOutDiv, "click", function() {
	  		map.setMapType(G_PHYSICAL_MAP);
        
      	});

      	map.getContainer().appendChild(container);
      	return container;
    }
//TextualZoomControl地图控制按钮定义结束。
	//地图控制器添加getDefaultPosition方法。
    TextualZoomControl.prototype.getDefaultPosition = function() {
      return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(17, 7));
    }
//给地图控制器添加样式方法。
    TextualZoomControl.prototype.setButtonStyle_ = function(button) {
      button.style.textDecoration = "underline";
      button.style.color = "#0000cc";
      button.style.backgroundColor = "white";
      button.style.font = "small-caps   9pt   serif";
	 
      button.style.border = "1px solid black";
      button.style.padding = "2px";
      button.style.marginBottom = "3px";
      button.style.textAlign = "center";
      button.style.width = "5em";
      button.style.cursor = "pointer";
    }

	
	var map = null;//地图对象。
	var mgr = null;
    var geocoder = null;
	var baseIcon=null;
	//页面的初始化方法。
    function initialize() {
      if (GBrowserIsCompatible()) {
	  
         map = new GMap2(document.getElementById("map_canvas"));
         
          
		map.addControl(new GSmallMapControl());//给地图添加控制器
		//map.addControl(new GMapTypeControl()); 
		map.addControl(new GOverviewMapControl());
     	map.enableDoubleClickZoom();
     	map.enableScrollWheelZoom();
     	map.enableContinuousZoom(); //
		map.setMapType(G_PHYSICAL_MAP);//设置地图显示类型。
		//shao guan is (24.996016,113.59314).
        //map.setCenter(new GLatLng(24.816498,113.597088), 14);
		//huizhou is (22.87965466225453,114.5438003540039)
		map.setCenter(new GLatLng(24.996016,113.59314), 9);//设置屏幕中心显示地图的坐标。
		 mgr = new MarkerManager(map, {trackMarkers:true});
		map.addControl(new TextualZoomControl());

		baseIcon = new GIcon();
        //baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
        baseIcon.shadow = "http://img.ifeng.com/tres/TemplateRes/84/84/images/gongshang.gif";
        
        baseIcon.iconSize = new GSize(20, 20);
        baseIcon.shadowSize = new GSize(37, 34);
        baseIcon.iconAnchor = new GPoint(9, 34);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);
        baseIcon.infoShadowAnchor = new GPoint(18, 25);
		var point =null;
		point = new GLatLng(23.139097,113.300629);
		var str='';
		str+='<table>';
		str+='<tr>';
		str+='<td>';
		str+='<a href="http://www.baidu.com">baidu</a>';
		str+='</td>';
		str+='</tr>';
		
		str+='';
		str+='</table>';
		var marker = createMarker3(point,'12.gif',str);
		//mgr.addMarker(marker,9);
		//mgr.refresh();
		//map.addOverlay(marker);
		//marker.openInfoWindowHtml(str);
	  }
    }
	
	function createMarker(point, imageName,html) {
          
          var letteredIcon = new GIcon(baseIcon);
          letteredIcon.image = "images/"+imageName;
		  
          // 设置 GMarkerOptions 对象
          markerOptions = { icon:letteredIcon,noCloseOnClick:true };
          var marker = new GMarker(point, markerOptions);

          GEvent.addListener(marker, "click", function() {
		  //alert(" map.getInfoWindow()="+ map.getInfoWindow());
            marker.openInfoWindowHtml("<div class='ipt' id=popupWin>" + html + "</div>");
          });
          return marker;
        }
		
	function createMarker3(point, imageName,html) {
          
		  baseIcon1 = new GIcon();
		  baseIcon1.shadow = "http://www.google.com/mapfiles/shadow50.png";
		  baseIcon1.iconSize = new GSize(38, 32);
		  baseIcon1.shadowSize = new GSize(37, 34);
		  baseIcon1.iconAnchor = new GPoint(9, 34);
		  baseIcon1.infoWindowAnchor = new GPoint(9, 2);
		  baseIcon1.infoShadowAnchor = new GPoint(18, 25);
          var letteredIcon = new GIcon(baseIcon1);
          letteredIcon.image = "images/"+imageName;
		  //alert(letteredIcon.image);
		  
          // 设置 GMarkerOptions 对象
          markerOptions = { icon:letteredIcon };
          var marker = new GMarker(point, markerOptions);

          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml("<div class='ipt' id=popupWin>" + html + "</div>");
          });
          return marker;
        }
        function createMarker2(point, imageName,html) {
          
		  baseIcon1 = new GIcon();
		  baseIcon1.shadow = "http://www.google.com/mapfiles/shadow50.png";
		  baseIcon1.iconSize = new GSize(140, 46);
		  baseIcon1.shadowSize = new GSize(2, 2);
		  baseIcon1.iconAnchor = new GPoint(9, 34);
		  baseIcon1.infoWindowAnchor = new GPoint(9, 2);
		  baseIcon1.infoShadowAnchor = new GPoint(2, 2);
          var letteredIcon = new GIcon(baseIcon1);
          letteredIcon.image = "images/"+imageName;
		  //alert(letteredIcon.image);
		  
          // 设置 GMarkerOptions 对象
          markerOptions = { icon:letteredIcon };
          var marker = new GMarker(point, markerOptions);

          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml("<div class='ipt' id=popupWin>" + html + "</div>");
          });
          return marker;
        }
		
		function callRemote(county,aitem)
{
	
	
	//alert(document.all.channelitem);
	
	var url = 'AjaxSubCorpServlet?county='+county+'&item='+aitem;  
	getResult(url);
	//alert(url);
}	
function getResult(url)
{  
	//var url = "AjaxServlet?action=send";  
	if (window.XMLHttpRequest) 
	{     req = new XMLHttpRequest();   
	}
	else if (window.ActiveXObject)
	{     
	req = new ActiveXObject("Microsoft.XMLHTTP");   
	}   
	if(req)
	{  
		
		req.open("GET",url, true);      
		req.onreadystatechange = complete;      
		req.send(null);   
	} 
} 
	 
/*分析返回的文本文档*/
function complete()
{  
//alert(1);
	var strResult;
	if(req.readyState == 4) 
	{     
		if (req.status == 200) 
		{      
		 //alert(req.responseText);  
		 strResult = (req.responseText);   
		 //document.getElementById('popupWin').style.width=600;
		 //document.getElementById('tb1').style.width=600;
		 //document.getElementById('tb2').style.width=600;
		 //document.getElementById('popupWin').style.height=270;
		 //alert(document.getElementById('popupWin'));
		 document.getElementById('picture').innerHTML =strResult;  
		 //marker.openInfoWindowHtml("<div class='ipt' id=popupWin>" + "test" + "</div>");
		 //alert(map);
		//map.openInfoWindow(map.getCenterLatLng(), document.createTextNode("Hello world"));
		var currentWin = map.getInfoWindow();
		//alert(currentWin.isHidden());
		//map.openInfoWindow( map.getCenter(),document.createTextNode(strResult),   {noCloseOnClick:true} ); 
		//map.bindInfoWindowHtml("DEN<br/>Denver International Airport");

		currentWin.hide();
		//alert(1);
		/*
		tabs = new Array()
		var tab = new GInfoWindowTab('Tab1','<a onclick=test()>My Tab1</a>'); 
		tabs.push(tab); 
		var tab = new GInfoWindowTab('Tab2','My Tab2'); 
		tabs.push(tab); 
		
		map.openInfoWindowTabsHtml(map.getCenter(),tabs) 
		
		*/
		currentWin.show();
		
		  
		}  
	}
	return strResult;
}

function test()
{
	tabs =map.getInfoWindow().getTabs();
	tab1= tabs[1];
	//alert(tab1.label);
	map.getInfoWindow().selectTab(1);
}
		
//展示google地图

</script>
<body onLoad="initialize()" onUnload="GUnload()" style="overflow-x:hidden;overflow-y:hidden">
<input type="hidden" id="screen" value="1">

<%@ include file="../googlemap_include2.jsp"%>    


</html>